blob: 6740f5f9636b9656bf38c4c992830f0b73c857b1 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
import { fail, redirect } from "@sveltejs/kit";
import { fd, auth, get, post } from "$lib/utils";
export const actions = {
default: async ({ cookies, request, url }) => {
let form = await fd(request);
try {
await post("/items", form, auth(cookies));
console.log("YEAH");
} catch (e) {
console.log("E", e)
return fail(400, { message: e.message });
}
let success = `/${url.pathname.split("/")[1]}`;
redirect(307, success);
},
};
|